package com.excilys.formation.projet.ebanking.webapp.controller;

import javax.servlet.ServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.excilys.formation.projet.ebanking.webapp.flash.FlashScopeModifier;

@Controller
public class CommonController {
	
	@RequestMapping("login.html")
	public String login(ModelMap model) {
		return "login";
	}
	
	@RequestMapping("loginFailure.html")
	public String failureLogin(ModelMap model, ServletRequest request) {
		FlashScopeModifier.getFlashScopeModifier().put(request, "erreurLogin", "Identifiant et/ou mot de passe incorrects");
		return "redirect:login.html";
	}
}
